# Importing Data
ARGENTINA <- read_excel("C:/Users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Steel/TSA.xlsx", sheet = "Sheet1", range = "B1:B239")

# Checking the Imported Data
View(ARGENTINA)
# Creating Time Series Data
ARGENTINA_ts <- ts(ARGENTINA, start=c(2000,1), end=c(2019,09), frequency=12)
# Viewing and Checking the Created Time Series Data
ARGENTINA_ts
sum(is.na(ARGENTINA_ts))
library(forecast)
ARGENTINA_ts <- tsclean(ARGENTINA_ts)
ARGENTINA_ts

# Identification: Plotting the Time Series Data
plot(ARGENTINA_ts)

# Estimating the appropriate model
ARGENTINA_ts_model <- auto.arima(ARGENTINA_ts)
ARGENTINA_ts_model

# Forecasting
options(max.print=1000000)
ARGENTINA_ts_forecast <- forecast (ARGENTINA_ts_model, level=c(95), h=255)
plot(ARGENTINA_ts_forecast)
ARGENTINA_ts_forecast             

# Exporting
write.table(ARGENTINA_ts_forecast, file="/Users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Steel/Argentina_TSA.csv", sep=",")
